import Vue from 'vue'
import store from './store'
import App from './App.vue'
import router from './router'
import 'jquery'
import './registerServiceWorker'
import './sass/app.scss';
import './js/app';
import axios from 'axios'
Vue.prototype.$axios = axios

import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
    /* Visit http://lbsyun.baidu.com/apiconsole/key for details about app key. */
    ak: 'f78iLa4F211GEWYFsWLAIq8rtzj3Q5Ud'
})
import VueAwesomeSwiper from 'vue-awesome-swiper'
Vue.use(VueAwesomeSwiper)

Vue.config.productionTip = false
Vue.filter('gdate', function(dates, fmt) {

	let date = new Date(dates*1000);
	if (!fmt) fmt = "yyyy-MM-dd";

	if (!date || date == null) return null;
	var o = {
	'M+': date.getMonth() + 1, // 月份
	'd+': date.getDate(), // 日
	'h+': date.getHours(), // 小时
	'm+': date.getMinutes(), // 分
	's+': date.getSeconds(), // 秒
	'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
	'S': date.getMilliseconds() // 毫秒
	}
	if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
		for (var k in o) {
			if (new RegExp('(' + k + ')').test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
		}
	return fmt
})

new Vue({
  router,
  store,
  created() {
	this.$axios
            .get(this.$store.state.domain+'/Index/index.json')
            .then(response => {
                this.$store.commit('menulistjson',response.data);
            })
            .catch(error => {
                console.log(error);
               
            });
  },
  render: h => h(App)
}).$mount('#app')
